package com.favoritemedium.util.geolocation;

/**
 * Distance calculation base type. Provides subtypes with some simple conversion
 * functionality.
 * 
 * @author S. Park
 * 
 */
public abstract class BaseDistCalc implements IDistCalc {

	public double deg2rad(double deg) {
		return (deg * Math.PI / 180.0);
	}

	public double rad2deg(double rad) {
		return (rad * 180.0 / Math.PI);
	}

	public static final double roundDouble(double d, int places) {
		return Math.round(d * Math.pow(10, (double) places))
				/ Math.pow(10, (double) places);
	}

    public abstract double calculateDistance(double lat1, double lon1, double lat2, double lon2, String unit);

}
